<?php
namespace app\common\model;

use app\api\controller\User;
use app\index\model\UserModel;
use think\admin\model\SystemFile;
use think\Model;

class JobOperationRecordModel extends Model{


    protected $table = 'boyi_job_operation_record';
    protected $pk = 'id';


    const OPERATE_TYPE_UNKNOW = "UNKNOW";
    const OPERATE_TYPE_RECEIVE = "RECEIVE";
    const OPERATE_TYPE_HANDLE = "HANDLE";
    const OPERATE_TYPE_EXAMINE = "EXAMINE";

    // 添加审核驳回和审核通过
    const OPERATE_TYPE_EXAMINE_FAIL = "EXAMINE_FAIL";
    const OPERATE_TYPE_EXAMINE_SUCCESS = "EXAMINE_SUCCESS";

    const OPERATE_TYPE_SUCCESS = "SUCCESS";
    const OPERATE_TYPE_CANCELLED = "CANCELLED";




    public $append = ['operate_type_info'];

    const OPERATE_TYPE_ARR = [
        self::OPERATE_TYPE_UNKNOW => [
            'info' => '未知状态',
            'button_type' => 'default',
        ],
        self::OPERATE_TYPE_RECEIVE => [
            'info' => '确认接单',
            'button_type' => 'info',
        ],
        self::OPERATE_TYPE_HANDLE => [
            'info' => '处理任务',
            'button_type' => 'primary',
        ],
        self::OPERATE_TYPE_EXAMINE => [
            'info' => '审核任务',
            'button_type' => 'default',
        ],
        self::OPERATE_TYPE_SUCCESS => [
            'info' => '审核成功',
            'button_type' => 'success',
        ],
        self::OPERATE_TYPE_CANCELLED => [
            'info' => '任务已作废',
            'button_type' => 'success',
        ],
        self::OPERATE_TYPE_EXAMINE_FAIL => [
            'info' => '审核被驳回',
            'button_type' => 'danger',
        ],
        self::OPERATE_TYPE_EXAMINE_SUCCESS => [
            'info' => '审核通过',
            'button_type' => 'success',
        ],
    ];


    public function getOperateTypeInfoAttr(){
        return self::OPERATE_TYPE_ARR[$this->operation_type] ?? [
            'info' => '未知状态',
            'button_type' => 'default',
        ];
    }

    

}